<template>
  <div id="app">
      <router-view></router-view>
  </div>
</template>
<script>
  export default {
    name:'App',
      data(){
        return{
        }
      },
      created() {
          /*加载数据*/
          //在页面加载时读取sessionStorage里的状态信息
          if(sessionStorage.getItem("store")){
              this.$store.replaceState(Object.assign({},this.$store.state,JSON.parse(sessionStorage.getItem("store"))))
          }
          //在页面刷新时将vuex里的信息保存到sessionStorage里
          window.addEventListener("beforeunload",()=>{
              sessionStorage.setItem("store",JSON.stringify(this.$store.state))
          });
      },
      mounted() {
      },
      methods:{
      },
      components:{
      }
  };
</script>

<style scoped>
    *{
        padding: 0;
        margin: 0;
        overflow: hidden;
        background-image: url("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1583849027630&di=6c27ca80c3d36d466f1eeb2ce5b7120a&imgtype=0&src=http%3A%2F%2Fimg.jk51.com%2Fimg_jk51%2F47961581.jpeg");
        background-size: cover;
        background-repeat: no-repeat;
    }
    #app{

    }
</style>
